package cn.jtfadmin.activiti.ueditor.controller;

import cn.jtfadmin.activiti.ueditor.ActionEnter;
import cn.jtfadmin.base.filesystem.config.FileSystem;
import cn.jtfadmin.base.filesystem.config.local.LocalFileSystemImpl;
import cn.jtfadmin.base.lang.common.utils.RequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * ueditor action controller
 * @author jtf
 * @version 0.0.2
 */
@WebServlet(name = "UEditorServlet", urlPatterns = "/activiti/ueditor/action")
public class UeditorActionController extends HttpServlet {


    public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
        doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding( "utf-8" );
        response.setHeader("Content-Type", "text/html");

        try {
            response.getWriter().write(new ActionEnter(request, "").exec());
        } catch (IOException e) {
            //
        }



    }

}
